<include file="../header" />
<body class="J_scroll_fixed">
    <script>

        $(document).ready(function() {
  
            $('button#send').click(function() {
                var vipId = $('input[name=id]').val();
                var shopId = $('input[name=shopId]').val();
                
                $.ajax({
                    type: "post",
                    url: "{:U('vip/isCheckIn')}",
                    data: {id: vipId,shopId:shopId},
                    dataType: "json",
                    success: function(data) {

                        if (data['errCode'] === 500) {
                            if(data['repeateCheckIn']!=null&&data['repeateCheckIn']==1){
                                layer.open({
                                    content: '你今天已经签入过了,请签出！是否继续签入,重复签入会影响您的声誉！'
                                    ,btn: ['确定', '否']
                                    ,yes: function(index, layero){ //或者使用btn1
                                        //
                                        $('input[name=checkIn]').val(1);
                                        $('form#train').submit();
                                    },cancel: function(index){ //或者使用btn2
                                        //按钮【按钮二】的回调
                                        layer.msg('请选择签出菜单,进行签出操作！');
                                    },btn3: function(index, layero){
                                        //按钮【按钮三】的回调
                                    }
                                });
                                
                            }else if(data['notCheckout']!=null&&data['notCheckout']==1){
                                layer.msg('您上次忘记签出,下次请签入签出！');
                                $('input[name=checkIn]').val(2);
                                $('form#train').submit();
                            }
                        } else if(data['errCode'] === 200){
                            layer.msg('正常签入');
                            $('input[name=checkIn]').val(null);
                            $('form#train').submit();
                        }
                        
                    },
                    error: function() {
                        layer.msg('请求出错！！');
                    }
                });

            });

        });
    </script>
<form class="well form-search" method="post" style="float:left;width:100%;" action="{:U('vip/checkIn')}">
    <div class="search_type cc mb10">
        <div class="mb10">
        <span class="mr20">
            店铺：
        {:getShopSelectHtml($shopId,0)}
            指纹：
        <input type="text" name="finger" class="input" value="{$finger}" />
        卡号：
        <input type="text" name="cardNumber" class="input" value="{$cardNumber}" />
        <button class="btn btn-primary search">搜索</button>
        <a class="btn" href="{:U('vip/checkIn')}">重置</a>
        </span>
        </div>
    </div>
</form>
<if condition="$isGet eq 1">

<elseif condition="$vipNotExist eq 1"/>
    用户不存在
<else/>
    <div class="wrap jj">
		<div class="common-form">
			<form id='train' method="post" class="form-horizontal J_ajaxForm" action="{:U('vip/checkInPost')}">
                                <input type="hidden" name="id" value="{$vip.vip_id}" />
                                <input type="hidden" name="shopId" value="{$shopId}" />
                                <input type="hidden" name="checkIn" value="" />
				<fieldset>
					<div class="control-group">
						<label class="control-label">姓名：</label>
						<div class="controls">
							<input type="text" class="input" name="vipName" value="{$vip.vip_name}" readonly>
						</div>
					</div>
                                        <div class="control-group">
						<label class="control-label">头像：</label>
						<div class="controls">
							<img src="/Uploads/VipImg/{$vip.head_image_url}" style="height:200px;width:200px;"/>
						</div>
					</div>
                                        <div class="control-group">
						<label class="control-label">手机号：</label>
						<div class="controls">
							<input type="text" class="input" name="mobile" value="{$vip.mobile}" readonly> 
						</div>
					</div>
                                        <div class="control-group">
						<label class="control-label">到期日期：</label>
						<div class="controls">
							<input type="text" class="input" name="endTime" value="{$vip.end_time}" readonly>
						</div>
					</div>
                                        
				</fieldset>
				<div class="form-actions">
                                    <if condition="$notValid eq 1">
                                        <span style="color: red;">已经到期</span>
                                    
                                    <else/>                                          
                                        <button type="button" class="btn btn-primary" id="send">签到</button>
                                    </if>
					
				</div>
			</form>
		</div>
	</div>
</if>

<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>